Week Overview Mon – Fri · 10 hours total

Build a VPN in three stages — PSK, certificates, then WireGuard

Week 5 is the most conceptually dense week of the course. Students build a complete site-to-site VPN between S1 and S3, starting with the simplest possible authentication method (a pre-shared key), then migrating to certificate-based authentication using a PKI that they build themselves, and finally building a WireGuard tunnel as a modern contrast. By Friday, they have experienced the full spectrum from IPSec's complexity to WireGuard's simplicity — and can explain why each exists.

The week builds directly on Week 4. The SSL certificate generated for Nginx used a self-signed cert with no CA chain behind it. The VPN certificate lab formalises that process: students create a root CA, issue server certificates from it, distribute the CA trust, and configure each endpoint to authenticate using its certificate. The PKI concepts are the same; the application is different.

The network topology expands this week. S3 gains a second NIC connected to a new internal subnet (LAN2 equivalent), acts as a NAT gateway for that subnet, and the VPN creates an encrypted tunnel between S1's LAN1 and S3's LAN subnet. S2 and S3's internal clients can then reach each other through the tunnel — the goal that motivates the entire week.

Week at a glance

Monday
VPN Concepts & Environment

IPSec architecture, IKE phases, ESP/AH, tunnel vs transport, topology setup — S3 as second gateway (Lab 5A)

Tuesday
StrongSwan PSK Tunnel

Install strongswan, ipsec.secrets PSK, ipsec.conf connection block, modified NAT rule, ipsec status verification (Lab 5B)

Wednesday
PKI & Certificate Authority

strongswan-pki, CA key and cert generation, issue server certs for S1 and S3, distribute trust (Lab 5C)

Thursday
Certificate-Based IPSec & WireGuard

Migrate PSK to RSA cert auth, verify SA, then WireGuard — key pairs, [Interface]/[Peer] config, routing, comparison (Lab 5D)

Friday
Mini-Assessment 5

Written: VPN concepts, IPSec config syntax, PKI, WireGuard. Practical: bring up a WireGuard tunnel from a spec.

Learning Outcomes By end of Week 5, students can…
Explain IPSec architectureDescribe IKE Phase 1 and Phase 2, the difference between ESP and AH, and when tunnel mode vs transport mode is used
Configure a StrongSwan PSK tunnelWrite ipsec.secrets and ipsec.conf on both endpoints, apply the correct NAT exclusion rule, and verify the SA with ipsec status
Verify VPN traffic with tcpdumpCapture encrypted ESP packets on the external interface and confirm traffic is flowing through the tunnel
Build a PKI with strongswan-pkiGenerate a CA private key, self-sign a root CA certificate, issue server certificates for both VPN endpoints, and inspect certificates with ipsec pki --print
Migrate a PSK tunnel to certificate authUpdate ipsec.secrets to RSA, add leftcert/leftid/rightid to ipsec.conf, distribute necessary files, and verify the SA re-establishes
Configure a WireGuard tunnelGenerate key pairs, write [Interface] and [Peer] sections on both endpoints, add routing, and verify connectivity
Compare IPSec and WireGuardArticulate the differences in complexity, configuration, code size, performance, and appropriate use cases
Monday Lecture + Lab 5A · 2 hrs

VPN fundamentals, IPSec architecture, and expanding the lab topology for S3

0:00–0:30
Lecture
0:30–1:50
Lab 5A
1:50–2:00
Debrief
Instructor note: The topology verification on Monday is critical. Students who arrive at Tuesday's lab without confirmed S1↔S3 external connectivity will be unable to establish the IPSec tunnel regardless of configuration correctness. Spend the full lab time on topology verification — a working baseline on Monday saves hours of frustration on Tuesday.
Tuesday Lab 5B · 2 hrs

StrongSwan PSK tunnel — ipsec.secrets, ipsec.conf, NAT exclusion, SA verification

0:00–0:10
Recap
0:10–1:50
Lab 5B
1:50–2:00
Debrief
Timing note: ipsec restart can take 15–30 seconds to negotiate the SA. Students who run ipsec status immediately after restart may see no SAs yet — advise them to wait 30 seconds before concluding there's a configuration error. The IKE negotiation takes time.
Wednesday Lecture + Lab 5C · 2 hrs

PKI fundamentals, building a CA with strongswan-pki, issuing server certificates

0:00–0:10
Recap
0:10–0:40
Lecture
0:40–1:50
Lab 5C
1:50–2:00
Debrief
Thursday Lab 5D · 2 hrs

Migrate to certificate auth, verify SA, then build WireGuard and compare

0:00–0:10
Recap
0:10–1:50
Lab 5D
1:50–2:00
Wrap
IPSec vs WireGuard on Thursday: The PSK tunnel from Tuesday and the cert-based tunnel should both be working before introducing WireGuard. WireGuard will use a different IP range (typically 10.0.0.x) for its virtual interface, separate from the IPSec tunnel. Having both running simultaneously is intentional — it shows they are independent technologies that can coexist.
Friday Mini-Assessment 5 · 2 hrs

Written (30%) + Practical: bring up a WireGuard tunnel from a spec (70%)

0:00–0:30
Written
0:30–1:45
Practical
1:45–2:00
Review + Preview W7

Mini-Assessment 5 — Topic Coverage

TopicWeightSource
IPSec architecture — IKE phases, ESP vs AH, tunnel vs transport15%Monday lecture
PSK configuration — ipsec.secrets and ipsec.conf syntax15%Lab 5B
NAT exclusion rule — why it's needed and how to write it10%Lab 5B
PKI and certificate generation — CA, server certs, file distribution15%Wednesday lecture + Lab 5C
Certificate-based ipsec.conf changes — leftcert, leftid, rightid10%Lab 5D
WireGuard configuration — key gen, [Interface], [Peer]15%Lab 5D
Practical: configure WireGuard tunnel from spec20%All week

What you need ready before Monday

All three VMs (S1, S2, S3) running with SSH accessible S1 and S3 reachable on their External IPs from each other Lab 5A, 5B, 5C, 5D handouts printed Mini-Assessment 5 printed (Friday) WireGuard practical spec prepared (pre-generate peer keys) Confirm strongswan and wireguard packages available in apt
← Week 4 Day 1 Lesson Plan → Week 6 → Course Outline